<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>qLibc: extensions/qdatabase.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('qdatabase_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">qdatabase.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Database wrapper.  
<a href="#details">More...</a></p>

<p><a href="qdatabase_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a5feeb5a7ad2b8531d2bdc2d5e94e344f"><td class="memItemLeft" align="right" valign="top">qdb_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a5feeb5a7ad2b8531d2bdc2d5e94e344f">qdb</a> (const char *dbtype, const char *addr, int port, const char *username, const char *password, const char *database, bool autocommit)</td></tr>
<tr class="memdesc:a5feeb5a7ad2b8531d2bdc2d5e94e344f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize internal connector structure.  <a href="#a5feeb5a7ad2b8531d2bdc2d5e94e344f">More...</a><br/></td></tr>
<tr class="separator:a5feeb5a7ad2b8531d2bdc2d5e94e344f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae90a2206952d27df4a58995628741134"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#ae90a2206952d27df4a58995628741134">open_</a> (qdb_t *db)</td></tr>
<tr class="memdesc:ae90a2206952d27df4a58995628741134"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;open(): Connect to database server  <a href="#ae90a2206952d27df4a58995628741134">More...</a><br/></td></tr>
<tr class="separator:ae90a2206952d27df4a58995628741134"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89fc888110ad23e6358d155e2c9b6a3b"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a89fc888110ad23e6358d155e2c9b6a3b">close_</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a89fc888110ad23e6358d155e2c9b6a3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;close(): Disconnect from database server  <a href="#a89fc888110ad23e6358d155e2c9b6a3b">More...</a><br/></td></tr>
<tr class="separator:a89fc888110ad23e6358d155e2c9b6a3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42069ce53c9e45b7283e9e44a7e021d9"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a42069ce53c9e45b7283e9e44a7e021d9">execute_update</a> (qdb_t *db, const char *query)</td></tr>
<tr class="memdesc:a42069ce53c9e45b7283e9e44a7e021d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a42069ce53c9e45b7283e9e44a7e021d9" title="qdb-&gt;execute_update(): Executes the update DML ">execute_update()</a>: Executes the update DML  <a href="#a42069ce53c9e45b7283e9e44a7e021d9">More...</a><br/></td></tr>
<tr class="separator:a42069ce53c9e45b7283e9e44a7e021d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99e372b7dd8e2d9c2bb4f762cc8dd5aa"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a99e372b7dd8e2d9c2bb4f762cc8dd5aa">execute_updatef</a> (qdb_t *db, const char *format,...)</td></tr>
<tr class="memdesc:a99e372b7dd8e2d9c2bb4f762cc8dd5aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a99e372b7dd8e2d9c2bb4f762cc8dd5aa" title="qdb-&gt;execute_updatef(): Executes the formatted update DML ">execute_updatef()</a>: Executes the formatted update DML  <a href="#a99e372b7dd8e2d9c2bb4f762cc8dd5aa">More...</a><br/></td></tr>
<tr class="separator:a99e372b7dd8e2d9c2bb4f762cc8dd5aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe4e5330b68b3fc9ff94b086939dba82"><td class="memItemLeft" align="right" valign="top">static qdbresult_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#abe4e5330b68b3fc9ff94b086939dba82">execute_query</a> (qdb_t *db, const char *query)</td></tr>
<tr class="memdesc:abe4e5330b68b3fc9ff94b086939dba82"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#abe4e5330b68b3fc9ff94b086939dba82" title="qdb-&gt;execute_query(): Executes the query ">execute_query()</a>: Executes the query  <a href="#abe4e5330b68b3fc9ff94b086939dba82">More...</a><br/></td></tr>
<tr class="separator:abe4e5330b68b3fc9ff94b086939dba82"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6fde99c74f91137ac554244ac60344be"><td class="memItemLeft" align="right" valign="top">static qdbresult_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a6fde99c74f91137ac554244ac60344be">execute_queryf</a> (qdb_t *db, const char *format,...)</td></tr>
<tr class="memdesc:a6fde99c74f91137ac554244ac60344be"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a6fde99c74f91137ac554244ac60344be" title="qdb-&gt;execute_queryf(): Executes the formatted query ">execute_queryf()</a>: Executes the formatted query  <a href="#a6fde99c74f91137ac554244ac60344be">More...</a><br/></td></tr>
<tr class="separator:a6fde99c74f91137ac554244ac60344be"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f27adbcda036187a4714e5bcd3a247e"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a2f27adbcda036187a4714e5bcd3a247e">begin_tran</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a2f27adbcda036187a4714e5bcd3a247e"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a2f27adbcda036187a4714e5bcd3a247e" title="qdb-&gt;begin_tran(): Start transaction ">begin_tran()</a>: Start transaction  <a href="#a2f27adbcda036187a4714e5bcd3a247e">More...</a><br/></td></tr>
<tr class="separator:a2f27adbcda036187a4714e5bcd3a247e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3386b5894d03e2f48deecb0b7c0632ea"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a3386b5894d03e2f48deecb0b7c0632ea">commit</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a3386b5894d03e2f48deecb0b7c0632ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a3386b5894d03e2f48deecb0b7c0632ea" title="qdb-&gt;commit(): Commit transaction ">commit()</a>: Commit transaction  <a href="#a3386b5894d03e2f48deecb0b7c0632ea">More...</a><br/></td></tr>
<tr class="separator:a3386b5894d03e2f48deecb0b7c0632ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ee4a69fbc4ecf80e795d6b6b3750ca7"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a6ee4a69fbc4ecf80e795d6b6b3750ca7">rollback</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a6ee4a69fbc4ecf80e795d6b6b3750ca7"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;rellback(): Roll-back and abort transaction  <a href="#a6ee4a69fbc4ecf80e795d6b6b3750ca7">More...</a><br/></td></tr>
<tr class="separator:a6ee4a69fbc4ecf80e795d6b6b3750ca7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5dc988c35746fe8a792702523abc66b3"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a5dc988c35746fe8a792702523abc66b3">set_fetchtype</a> (qdb_t *db, bool fromdb)</td></tr>
<tr class="memdesc:a5dc988c35746fe8a792702523abc66b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a5dc988c35746fe8a792702523abc66b3" title="qdb-&gt;set_fetchtype(): Set result fetching type ">set_fetchtype()</a>: Set result fetching type  <a href="#a5dc988c35746fe8a792702523abc66b3">More...</a><br/></td></tr>
<tr class="separator:a5dc988c35746fe8a792702523abc66b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0598e067ed6b749c9df042cd7bc83f5c"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a0598e067ed6b749c9df042cd7bc83f5c">get_conn_status</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a0598e067ed6b749c9df042cd7bc83f5c"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a0598e067ed6b749c9df042cd7bc83f5c" title="qdb-&gt;get_conn_status(): Get last connection status ">get_conn_status()</a>: Get last connection status  <a href="#a0598e067ed6b749c9df042cd7bc83f5c">More...</a><br/></td></tr>
<tr class="separator:a0598e067ed6b749c9df042cd7bc83f5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a998f1143e4b00ff847f120e34a0efc0d"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a998f1143e4b00ff847f120e34a0efc0d">ping</a> (qdb_t *db)</td></tr>
<tr class="memdesc:a998f1143e4b00ff847f120e34a0efc0d"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a998f1143e4b00ff847f120e34a0efc0d" title="qdb-&gt;ping(): Checks whether the connection to the server is working. ">ping()</a>: Checks whether the connection to the server is working.  <a href="#a998f1143e4b00ff847f120e34a0efc0d">More...</a><br/></td></tr>
<tr class="separator:a998f1143e4b00ff847f120e34a0efc0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11f5b1c5de493c27e1d396f7593408a0"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a11f5b1c5de493c27e1d396f7593408a0">get_error</a> (qdb_t *db, unsigned int *errorno)</td></tr>
<tr class="memdesc:a11f5b1c5de493c27e1d396f7593408a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;<a class="el" href="qdatabase_8c.html#a11f5b1c5de493c27e1d396f7593408a0" title="qdb-&gt;get_error(): Get error number and message ">get_error()</a>: Get error number and message  <a href="#a11f5b1c5de493c27e1d396f7593408a0">More...</a><br/></td></tr>
<tr class="separator:a11f5b1c5de493c27e1d396f7593408a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe5578f18ea12e68e96a80b91bd9be9d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#afe5578f18ea12e68e96a80b91bd9be9d">free_</a> (qdb_t *db)</td></tr>
<tr class="memdesc:afe5578f18ea12e68e96a80b91bd9be9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdb-&gt;free(): De-allocate qdb_t structure  <a href="#afe5578f18ea12e68e96a80b91bd9be9d">More...</a><br/></td></tr>
<tr class="separator:afe5578f18ea12e68e96a80b91bd9be9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c32ab62afb92fb6a55cfaff7c92bf42"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a3c32ab62afb92fb6a55cfaff7c92bf42">_resultGetStr</a> (qdbresult_t *result, const char *field)</td></tr>
<tr class="memdesc:a3c32ab62afb92fb6a55cfaff7c92bf42"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_str(): Get the result as string by field name  <a href="#a3c32ab62afb92fb6a55cfaff7c92bf42">More...</a><br/></td></tr>
<tr class="separator:a3c32ab62afb92fb6a55cfaff7c92bf42"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3559441aaa0ae5f19965612dccca8d5"><td class="memItemLeft" align="right" valign="top">static const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#ae3559441aaa0ae5f19965612dccca8d5">_resultGetStrAt</a> (qdbresult_t *result, int idx)</td></tr>
<tr class="memdesc:ae3559441aaa0ae5f19965612dccca8d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_str_at(): Get the result as string by column number  <a href="#ae3559441aaa0ae5f19965612dccca8d5">More...</a><br/></td></tr>
<tr class="separator:ae3559441aaa0ae5f19965612dccca8d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7608c9e6913b4d3c71d62cd43073fd1"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#aa7608c9e6913b4d3c71d62cd43073fd1">_resultGetInt</a> (qdbresult_t *result, const char *field)</td></tr>
<tr class="memdesc:aa7608c9e6913b4d3c71d62cd43073fd1"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_int(): Get the result as integer by field name  <a href="#aa7608c9e6913b4d3c71d62cd43073fd1">More...</a><br/></td></tr>
<tr class="separator:aa7608c9e6913b4d3c71d62cd43073fd1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b5beda54ba78647276bc180f65138ca"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a6b5beda54ba78647276bc180f65138ca">_resultGetIntAt</a> (qdbresult_t *result, int idx)</td></tr>
<tr class="memdesc:a6b5beda54ba78647276bc180f65138ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_int_at(): Get the result as integer by column number  <a href="#a6b5beda54ba78647276bc180f65138ca">More...</a><br/></td></tr>
<tr class="separator:a6b5beda54ba78647276bc180f65138ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb86d8858bb8ea5dd06e052f8f3e9a09"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#aeb86d8858bb8ea5dd06e052f8f3e9a09">_resultGetNext</a> (qdbresult_t *result)</td></tr>
<tr class="memdesc:aeb86d8858bb8ea5dd06e052f8f3e9a09"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_next(): Retrieves the next row of a result set  <a href="#aeb86d8858bb8ea5dd06e052f8f3e9a09">More...</a><br/></td></tr>
<tr class="separator:aeb86d8858bb8ea5dd06e052f8f3e9a09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95d88451db51492ae6122701ce56b94d"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a95d88451db51492ae6122701ce56b94d">result_get_cols</a> (qdbresult_t *result)</td></tr>
<tr class="memdesc:a95d88451db51492ae6122701ce56b94d"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_cols(): Get the number of columns in the result set  <a href="#a95d88451db51492ae6122701ce56b94d">More...</a><br/></td></tr>
<tr class="separator:a95d88451db51492ae6122701ce56b94d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26f8b55348c57f467d64c002ab306ff6"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a26f8b55348c57f467d64c002ab306ff6">result_get_rows</a> (qdbresult_t *result)</td></tr>
<tr class="memdesc:a26f8b55348c57f467d64c002ab306ff6"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_rows(): Get the number of rows in the result set  <a href="#a26f8b55348c57f467d64c002ab306ff6">More...</a><br/></td></tr>
<tr class="separator:a26f8b55348c57f467d64c002ab306ff6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a396a7328f7fb499f89c2652598185dc8"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a396a7328f7fb499f89c2652598185dc8">result_get_row</a> (qdbresult_t *result)</td></tr>
<tr class="memdesc:a396a7328f7fb499f89c2652598185dc8"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;get_row(): Get the current row number  <a href="#a396a7328f7fb499f89c2652598185dc8">More...</a><br/></td></tr>
<tr class="separator:a396a7328f7fb499f89c2652598185dc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ab66a07fa82b706895e1b2c19fcd501"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qdatabase_8c.html#a4ab66a07fa82b706895e1b2c19fcd501">result_free</a> (qdbresult_t *result)</td></tr>
<tr class="memdesc:a4ab66a07fa82b706895e1b2c19fcd501"><td class="mdescLeft">&#160;</td><td class="mdescRight">qdbresult-&gt;free(): De-allocate the result  <a href="#a4ab66a07fa82b706895e1b2c19fcd501">More...</a><br/></td></tr>
<tr class="separator:a4ab66a07fa82b706895e1b2c19fcd501"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Database wrapper. </p>
<p>Database header files should be included prior to <a class="el" href="qlibcext_8h.html" title="qlibc extension header file. ">qlibcext.h</a> in your source codes like below.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;mysql.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="qlibcext_8h.html">qlibcext.h</a>&quot;</span></div>
</div><!-- fragment --><div class="fragment"><div class="line">qdb_t *db = NULL;</div>
<div class="line">qdbresult_t *result = NULL;</div>
<div class="line"></div>
<div class="line">db = <a class="code" href="qdatabase_8c.html#a5feeb5a7ad2b8531d2bdc2d5e94e344f">qdb</a>(<span class="stringliteral">&quot;MYSQL&quot;</span>, <span class="stringliteral">&quot;dbhost.qdecoder.org&quot;</span>, 3306,</div>
<div class="line">         <span class="stringliteral">&quot;test&quot;</span>, <span class="stringliteral">&quot;secret&quot;</span>, <span class="stringliteral">&quot;sampledb&quot;</span>, <span class="keyword">true</span>);</div>
<div class="line"><span class="keywordflow">if</span> (db == NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;ERROR: Not supported database type.\n&quot;</span>);</div>
<div class="line">  <span class="keywordflow">return</span> -1;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">// try to connect</span></div>
<div class="line"><span class="keywordflow">if</span> (db-&gt;open(db) == <span class="keyword">false</span>) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;WARNING: Can&#39;t connect to database.\n&quot;</span>);</div>
<div class="line">  <span class="keywordflow">return</span> -1;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">// get results</span></div>
<div class="line">result = db-&gt;execute_query(db, <span class="stringliteral">&quot;SELECT name, population FROM City&quot;</span>);</div>
<div class="line"><span class="keywordflow">if</span> (result != NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;COLS : %d , ROWS : %d\n&quot;</span>,</div>
<div class="line">         result-&gt;get_cols(result), result-&gt;get_rows(result));</div>
<div class="line">  <span class="keywordflow">while</span> (result-&gt;get_next(result) == <span class="keyword">true</span>) {</div>
<div class="line">    <span class="keywordtype">char</span> *pszName = result-&gt;get_str(result, <span class="stringliteral">&quot;name&quot;</span>);</div>
<div class="line">    <span class="keywordtype">int</span>   nPopulation = result-&gt;get_int(result, <span class="stringliteral">&quot;population&quot;</span>);</div>
<div class="line">    printf(<span class="stringliteral">&quot;Country : %s , Population : %d\n&quot;</span>, pszName, nPopulation);</div>
<div class="line">  }</div>
<div class="line">  result-&gt;free(result);</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">// close connection</span></div>
<div class="line">db-&gt;close(db);</div>
<div class="line"></div>
<div class="line"><span class="comment">// free db object</span></div>
<div class="line">db-&gt;free(db);</div>
</div><!-- fragment --> 
<p>Definition in file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a5feeb5a7ad2b8531d2bdc2d5e94e344f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">qdb_t* qdb </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>dbtype</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>addr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>port</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>username</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>password</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>database</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>autocommit</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize internal connector structure. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dbtype</td><td>database server type. currently "MYSQL" is only supported </td></tr>
    <tr><td class="paramname">addr</td><td>ip or fqdn address. </td></tr>
    <tr><td class="paramname">port</td><td>port number </td></tr>
    <tr><td class="paramname">username</td><td>database username </td></tr>
    <tr><td class="paramname">password</td><td>database password </td></tr>
    <tr><td class="paramname">database</td><td>database server type. currently "MYSQL" is only supported </td></tr>
    <tr><td class="paramname">autocommit</td><td>sets autocommit mode on if autocommit is true, off if autocommit is false</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of qdb_t object in case of successful, otherwise returns NULL.</dd></dl>
<div class="fragment"><div class="line">qdb_t *db = <a class="code" href="qdatabase_8c.html#a5feeb5a7ad2b8531d2bdc2d5e94e344f">qdb</a>(<span class="stringliteral">&quot;MYSQL&quot;</span>,</div>
<div class="line">                <span class="stringliteral">&quot;dbhost.qdecoder.org&quot;</span>, 3306, <span class="stringliteral">&quot;test&quot;</span>, <span class="stringliteral">&quot;secret&quot;</span>,</div>
<div class="line">                <span class="stringliteral">&quot;sampledb&quot;</span>, <span class="keyword">true</span>);</div>
<div class="line"><span class="keywordflow">if</span> (db == NULL) {</div>
<div class="line">  printf(<span class="stringliteral">&quot;ERROR: Not supported database type.\n&quot;</span>);</div>
<div class="line">  <span class="keywordflow">return</span> -1;</div>
<div class="line">}</div>
</div><!-- fragment --> 
<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00162">162</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="ae90a2206952d27df4a58995628741134"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool open_ </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;open(): Connect to database server </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00232">232</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a89fc888110ad23e6358d155e2c9b6a3b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool close_ </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;close(): Disconnect from database server </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Unless you call qdb-&gt;free(), qdb_t object will keep the database information. So you can re-connect to database using qdb-&gt;open(). </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00323">323</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a42069ce53c9e45b7283e9e44a7e021d9"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int execute_update </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>query</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a42069ce53c9e45b7283e9e44a7e021d9" title="qdb-&gt;execute_update(): Executes the update DML ">execute_update()</a>: Executes the update DML </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">query</td><td>query string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a number of affected rows </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00352">352</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a99e372b7dd8e2d9c2bb4f762cc8dd5aa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int execute_updatef </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a99e372b7dd8e2d9c2bb4f762cc8dd5aa" title="qdb-&gt;execute_updatef(): Executes the formatted update DML ">execute_updatef()</a>: Executes the formatted update DML </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">format</td><td>query string format</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a number of affected rows, otherwise returns -1 </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00383">383</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="abe4e5330b68b3fc9ff94b086939dba82"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static qdbresult_t* execute_query </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>query</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#abe4e5330b68b3fc9ff94b086939dba82" title="qdb-&gt;execute_query(): Executes the query ">execute_query()</a>: Executes the query </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">query</td><td>query string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of qdbresult_t if successful, otherwise returns NULL </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00403">403</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a6fde99c74f91137ac554244ac60344be"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static qdbresult_t* execute_queryf </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a6fde99c74f91137ac554244ac60344be" title="qdb-&gt;execute_queryf(): Executes the formatted query ">execute_queryf()</a>: Executes the formatted query </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">format</td><td>query string format</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of qdbresult_t if successful, otherwise returns NULL </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00460">460</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a2f27adbcda036187a4714e5bcd3a247e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool begin_tran </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a2f27adbcda036187a4714e5bcd3a247e" title="qdb-&gt;begin_tran(): Start transaction ">begin_tran()</a>: Start transaction </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false</dd></dl>
<div class="fragment"><div class="line">db-&gt;begin_tran(db);</div>
<div class="line">(... insert/update/<span class="keyword">delete</span> ...)</div>
<div class="line">db-&gt;commit(db);</div>
</div><!-- fragment --> 
<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00484">484</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a3386b5894d03e2f48deecb0b7c0632ea"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool commit </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a3386b5894d03e2f48deecb0b7c0632ea" title="qdb-&gt;commit(): Commit transaction ">commit()</a>: Commit transaction </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00515">515</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a6ee4a69fbc4ecf80e795d6b6b3750ca7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool rollback </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;rellback(): Roll-back and abort transaction </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, otherwise returns false </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00541">541</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a5dc988c35746fe8a792702523abc66b3"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool set_fetchtype </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>fromdb</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a5dc988c35746fe8a792702523abc66b3" title="qdb-&gt;set_fetchtype(): Set result fetching type ">set_fetchtype()</a>: Set result fetching type </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">fromdb</td><td>false for storing the results to client (default mode), true for fetching directly from server,</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful otherwise returns false</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If qdb-&gt;set_fetchtype(db, true) is called, the results does not actually read into the client. Instead, each row must be retrieved individually by making calls to qdbresult-&gt;get_next(). This reads the result of a query directly from the server without storing it in local buffer, which is somewhat faster and uses much less memory than default behavior qdb-&gt;set_fetchtype(db, false). </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00577">577</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a0598e067ed6b749c9df042cd7bc83f5c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool get_conn_status </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a0598e067ed6b749c9df042cd7bc83f5c" title="qdb-&gt;get_conn_status(): Get last connection status ">get_conn_status()</a>: Get last connection status </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the connection flag is set to alive, otherwise returns false</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function just returns the the connection status flag. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00594">594</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a998f1143e4b00ff847f120e34a0efc0d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool ping </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a998f1143e4b00ff847f120e34a0efc0d" title="qdb-&gt;ping(): Checks whether the connection to the server is working. ">ping()</a>: Checks whether the connection to the server is working. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if connection is alive, false if connection is not available and failed to reconnect</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the connection has gone down, an attempt to reconnect. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00612">612</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a11f5b1c5de493c27e1d396f7593408a0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static const char* get_error </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int *&#160;</td>
          <td class="paramname"><em>errorno</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;<a class="el" href="qdatabase_8c.html#a11f5b1c5de493c27e1d396f7593408a0" title="qdb-&gt;get_error(): Get error number and message ">get_error()</a>: Get error number and message </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
    <tr><td class="paramname">errorno</td><td>if not NULL, error number will be stored</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer of error message string</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Do not free returned error message </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00643">643</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="afe5578f18ea12e68e96a80b91bd9be9d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void free_ </td>
          <td>(</td>
          <td class="paramtype">qdb_t *&#160;</td>
          <td class="paramname"><em>db</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdb-&gt;free(): De-allocate qdb_t structure </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>a pointer of qdb_t object </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00666">666</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a3c32ab62afb92fb6a55cfaff7c92bf42"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static const char* _resultGetStr </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>field</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_str(): Get the result as string by field name </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t </td></tr>
    <tr><td class="paramname">field</td><td>column name</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a string pointer if successful, otherwise returns NULL.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Do not free returned string. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00698">698</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="ae3559441aaa0ae5f19965612dccca8d5"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static const char* _resultGetStrAt </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idx</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_str_at(): Get the result as string by column number </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t </td></tr>
    <tr><td class="paramname">idx</td><td>column number (first column is 1)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a string pointer if successful, otherwise returns NULL. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00726">726</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="aa7608c9e6913b4d3c71d62cd43073fd1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int _resultGetInt </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>field</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_int(): Get the result as integer by field name </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t </td></tr>
    <tr><td class="paramname">field</td><td>column name</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a integer converted value </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00750">750</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a6b5beda54ba78647276bc180f65138ca"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int _resultGetIntAt </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>idx</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_int_at(): Get the result as integer by column number </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t </td></tr>
    <tr><td class="paramname">idx</td><td>column number (first column is 1)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a integer converted value </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00765">765</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="aeb86d8858bb8ea5dd06e052f8f3e9a09"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool _resultGetNext </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_next(): Retrieves the next row of a result set </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if successful, false if no more rows are left </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00779">779</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a95d88451db51492ae6122701ce56b94d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int result_get_cols </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_cols(): Get the number of columns in the result set </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of columns in the result set </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00800">800</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a26f8b55348c57f467d64c002ab306ff6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int result_get_rows </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_rows(): Get the number of rows in the result set </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of rows in the result set </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00817">817</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a396a7328f7fb499f89c2652598185dc8"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int result_get_row </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;get_row(): Get the current row number </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>current fetching row number of the result set</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This number is sequencial counter which is started from 1. </dd></dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00837">837</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
<a class="anchor" id="a4ab66a07fa82b706895e1b2c19fcd501"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void result_free </td>
          <td>(</td>
          <td class="paramtype">qdbresult_t *&#160;</td>
          <td class="paramname"><em>result</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>qdbresult-&gt;free(): De-allocate the result </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">result</td><td>a pointer of qdbresult_t </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="qdatabase_8c_source.html#l00852">852</a> of file <a class="el" href="qdatabase_8c_source.html">qdatabase.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_40c73bf2095fd0473b1b85ccdcac2768.html">extensions</a></li><li class="navelem"><a class="el" href="qdatabase_8c.html">qdatabase.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
